﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Chapter06
{
    using Chapter06.View;

    /// <summary>
    /// 第6章 控件
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            #region 01 控件类
            /*
             * 01 背景画刷和前景画刷
             * 02 字体
             * 03 鼠标光标
             * */
            #endregion

            #region 02 内容控件
            /*
             * 01 Content 属性
             * 02 对方内容
             * 03 WPF 内容原则
             * 04 标签
             * 05 按钮
             * 06 工具提示
             * */
            #endregion

            #region 03 特殊容器
            /*
             * 01 ScrollViewer
             * 02 GroupBox
             * 03 TabItem
             * 04 Expander
             * */
            #endregion

            #region 04 文本控件
            /*
             * 01 多行文本
             * 02 选择文本
             * 03 拼写检查
             * 04 PasswordBox
             * */
            #endregion

            #region 05 列表控件
            /*
             * 01 ListBox
             * 02 ComboBox
             * 03 基于范围的控件
             * 03.01 Slider
             * 03.02 ProgressBar
             * */
            #endregion

            #region 06 日期控件
            #endregion

            #region 07 小结
            #endregion
        }

        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Command == ApplicationCommands.Open)
            {
                var button = e.Source as Button;
                if (button != null)
                {
                    if (button == button1)
                    {
                        var window = new ButtonWithContentWindow();
                        Demo(window);
                    }
                    if (button == button2)
                    {
                        var window = new PaddingComparionWindow();
                        Demo(window);
                    }
                    if (button == button3)
                    {
                        var window = new ButtonWithShapeWindow();
                        Demo(window);
                    }
                    if (button == button4)
                    {
                        var window = new LabelTestWindow();
                        Demo(window);
                    }
                    if (button == button5)
                    {
                        var window = new ToolTipTestWindow();
                        Demo(window);
                    }
                    if (button == button6)
                    {
                        var window = new ToolTipTest2Window();
                        Demo(window);
                    }
                    if (button == button7)
                    {
                        var window = new PoputTestWindow();
                        Demo(window);
                    }
                    if (button == button8)
                    {
                        var window = new TextBoxColumnWindow();
                        Demo(window);
                    }
                    if (button == button9)
                    {
                        var window = new GroupBoxWindow();
                        Demo(window);
                    }
                    if (button == button10)
                    {
                        var window = new TabTestWindow();
                        Demo(window);
                    }
                    if (button == button11)
                    {
                        var window = new GraphicalTabTitlesWindow();
                        Demo(window);
                    }
                    if (button == button12)
                    {
                        var window = new ExpandableContentWindow();
                        Demo(window);
                    }
                    if (button == button13)
                    {
                        var window = new MultiDirectionExpandersWindow();
                        Demo(window);
                    }
                    if (button == button14)
                    {
                        var window = new TextBoxTestWindow();
                        Demo(window);
                    }
                    if (button == button15)
                    {
                        var window = new ImageListWindow();
                        Demo(window);
                    }
                    if (button == button16)
                    {
                        var window = new CheckBoxListWindow();
                        Demo(window);
                    }
                    if (button == button17)
                    {
                        var window = new SlidersComparedWindow();
                        Demo(window);
                    }
                    if (button == button18)
                    {
                        var window = new DateControlsWindow();
                        Demo(window);
                    }
                }
            }
        }

        private void Demo(Window window)
        {
            window.Owner = this;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();
        }
    }
}
